<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <title>修改staff</title>
  <meta name="description" content="" />
  <meta name="author" content="pc" />
  <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1, minimum-scale=1, user-scalable=no" />
  <meta name="screen-orientation"content="portrait">
  <meta name="format-detection" content="telephone=no" />
  <#include "/inc/common.html">
</head>
<body>
     <div style="margin-bottom: 10px">
	    <input type="button" value="返回" style="width: 80px; height: 30px; vertical-align: bottom; line-height: 10px;" class="btn-primary" onclick="staffBack()" /> 
		<input type="button" value="保存" style="width: 80px; height: 30px; vertical-align: bottom; line-height: 10px;" class="btn-primary" onclick="staffSave()" /> 
		<input type="button" value="取消" style="width: 80px; height: 30px; vertical-align: bottom; line-height: 10px;" class="btn-primary" onclick="staffCancle()" /> 
	 </div>
	 <div>
      <form id="staffUpdateFm" name="staffUpdateFm"  method="post" action="">
          <input type="hidden" name="pkid" value="${staff.pkid}"/>
          <table border="0" cellpadding="0"  cellspacing="0"
	         class="formlist"  style="width: 90%; table-layout: fixed;">
                      <tr>
                            <th>职员姓名</th>
                            <td><input id='sname' name='sname' value='${staff.sname}' class="{required:true,maxlength:30}"/></td>
                            <th>职员性别</th>
                            <td><select id='sex' name='sex' style="width: 174px;" value='${staff.sex}'
								class="publicSelect2" >
								<#if staff.sex??&&staff.sex ='1'>
									<option value="1" selected>男</option>
									<option value="0" >女</option>
								</#if>
								<#if staff.sex??&&staff.sex ='0'>
								     <option value="1" >男</option>
									<option value="0" selected>女</option>
								</#if>
							</select></td>
                      </tr>
                      <tr>
                            <th>职员年龄</th>
                            <td><input id='age'  name='age' value='${staff.age}'/></td>
                            <th>创建职员时间</th>
                            <td><input id='createDate'  name='createDate' class="required date" readonly='true' onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"    value="<#if staff.createDate ??>${staff.createDate?string('yyyy-MM-dd HH:mm:ss')}</#if>"/></td>
                      </tr>
                      <tr>
                            <th>职员创建者</th>
                            <td><input id='createby' name='createby' value='${staff.createby}' /></td>
                            <th>更新职员时间</th>
                            <td><input id='updateDate'  name='updateDate' class="required date" readonly='true' onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"    value="<#if staff.updateDate ??>${staff.updateDate?string('yyyy-MM-dd HH:mm:ss')}</#if>"/></td>
                      </tr>
                      <tr>
                             <th>职员信息更新人</th>
                             <td><input id='updateby' name='updateby' value='${staff.updateby}' /></td> 
                             <th>police</th>
                             <td style="width:50px;">
                             <#--图片存在的时候，显示缩略图-->
                             <#if staff.police??>
                                <img src="${request.contextPath}/staff/getPhoto?pkid=${staff.pkid}" style="width:172px;height:50px;"/>
                             </#if>
                               <!-- <input id='policeFile' name='policeFile'  type="file" class="required" accept="image/jpeg"/> -->
                               <input id='policeFile' name='policeFile'  type="file"  accept="image/jpeg"/>
                             </td> 
                      </tr>

          </table>
       </form>
     </div> 
     <script type="text/javascript">
       function staffSave(){//保存
          if($('#staffUpdateFm').valid()){//验证通过
	        	  $.ajaxFileUpload({
	      		    url: $.common.basePath+'/staff/update',
			            type: 'post',
			            secureuri: false, //一般设置为false
			            fileElementId: 'policeFile', // 上传文件的id、name属性名
			            dataType: 'json', //返回值类型，一般设置为json、application/json
			            data:$('#staffUpdateFm').serializeObject(),
			            success: function(data, status){ 
			            	if(data==true){
								layer.msg('修改成功', {
					    				icon:1, 
									    time: 500,
									    end: function(index, layero){ 
									         parent.layer.close(parent.layer.getFrameIndex(window.name));  // 关闭layer
									    	 window.parent.location.reload(); //刷新父页面
											 //window.location.href=$.common.basePath+'/staff/init';
										}
								}); 
							}else{
							    layer.msg('修改失败', {
				    				icon:5, 
								    time: 500,
								    end: function(index, layero){ 
								         parent.layer.close(parent.layer.getFrameIndex(window.name));  // 关闭layer
									     window.parent.location.reload(); //刷新父页面
										 //window.location.href=$.common.basePath+'/staff/init';
									}
							    });
							}
			            } ,
			        	error: function(json, status) {
						    layer.msg('系统异常,请稍后重试或联系技术人员', {
			    				icon:5, 
							    time: 1500,
							    end: function(index, layero){ 
									 parent.layer.close(parent.layer.getFrameIndex(window.name));  // 关闭layer
									 window.parent.location.reload(); //刷新父页面
									 //window.location.href=$.common.basePath+'/staff/init';
								}
						    });
						}
	      	  });
		  }
       }
       function staffCancle(){//取消
          $(':input','#staffUpdateFm') 
			    .not(':button, :submit, :reset, :hidden') 
			    .val('') 
			    .removeAttr('checked') 
			    .removeAttr('selected');
       }
       function staffBack(){//返回
          parent.layer.close(parent.layer.getFrameIndex(window.name));  // 关闭layer
		  window.parent.location.reload(); //刷新父页面
          //window.location.href=$.common.basePath+'/staff/init';
       }
     </script>
  </body>
</html>
